-
Notifications
You must be signed in to change notification settings - Fork 60
Print contents of array in __repr__
#2091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print contents of array in __repr__
#2091
Conversation
|
Thank you for the PR! |
|
I am kind of lost why this fails. On Jureca I get Same result with cpu array and the tests pass both in serial as well as in parallel. So it seems to work also on GPUs. Anyone any ideas? I will not spend time on this until we decide that we even want this behavior. |
|
We decided that we will try for a compromise. Rather than either printing the content or only the debug information about an array, in |
__repr__ only when a debugger has set a trace__repr__
|
Thank you for the PR! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2091 +/- ##
=======================================
Coverage 91.68% 91.68%
=======================================
Files 89 89
Lines 13945 13946 +1
=======================================
+ Hits 12786 12787 +1
Misses 1159 1159
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My minor suggestion is to add the tag 'data:' before showing the local data.
I added the tag, such that the example from the description now is: Putting it in the line where the data begins somehow looked odd to me. |
|
Thank you for the PR! |
|
Thank you for the PR! |
mtar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine 👍
|
Successfully created backport PR for |
Due Diligence
Description
Python uses
__repr__and__str__to give textual information about objects. The intention is that__repr__gives output for developers and__str__gives output for users. In heat arrays, this means__repr__tells you, for each MPI rank, what kind of data is contained in the array, while__str__tells you the actual data.This is all well and good but the problem is when people are using heat interactively, in which case they get the
__repr__if they just print the array, but if they are users, they want to know the data and not the local shape.For example:
when doing something like this, you tend to want to know the contents of the array in both cases.
In this PR, information about the contents of the array is appended. Before you got
with the changes introduced here, you get
Compare this to the
__str__outputLet me know what you think about this.
Issue/s resolved: #2018
Changes proposed:
__repr__with multiple processes